
package net.muhu.domain;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.builder.JAXBEqualsBuilder;
import org.jvnet.jaxb2_commons.lang.builder.JAXBHashCodeBuilder;
import org.jvnet.jaxb2_commons.lang.builder.JAXBToStringBuilder;


/**
 * galaxy, solar system, planet, municipality, stage
 *       
 * 
 * <p>Java class for Location complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="Location">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="id" type="{urn:net:muhu:domain}NonEmptyString"/>
 *         &lt;element name="name" type="{urn:net:muhu:domain}NonEmptyString"/>
 *         &lt;element name="location" type="{urn:net:muhu:domain}Location" maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="hunter" type="{urn:net:muhu:domain}MusicHunter" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Location", propOrder = {
    "id",
    "name",
    "location",
    "hunter"
})
@XmlSeeAlso({
    Musiverse.class,
    Planet.class,
    Solarsystem.class,
    Galaxy.class,
    Spaceship.class,
    Stage.class
})
public class Location
    implements Equals, HashCode, ToString
{

    @XmlElement(required = true)
    protected String id;
    @XmlElement(required = true)
    protected String name;
    protected List<Location> location;
    protected List<MusicHunter> hunter;

    /**
     * Gets the value of the id property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setId(String value) {
        this.id = value;
    }

    /**
     * Gets the value of the name property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the location property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the location property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getLocation().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Location }
     * 
     * 
     */
    public List<Location> getLocation() {
        if (location == null) {
            location = new ArrayList<Location>();
        }
        return this.location;
    }

    /**
     * Gets the value of the hunter property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the hunter property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getHunter().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link MusicHunter }
     * 
     * 
     */
    public List<MusicHunter> getHunter() {
        if (hunter == null) {
            hunter = new ArrayList<MusicHunter>();
        }
        return this.hunter;
    }

    public void equals(Object object, EqualsBuilder equalsBuilder) {
        if (!(object instanceof Location)) {
            equalsBuilder.appendSuper(false);
            return ;
        }
        if (this == object) {
            return ;
        }
        final Location that = ((Location) object);
        equalsBuilder.append(this.getId(), that.getId());
        equalsBuilder.append(this.getName(), that.getName());
        equalsBuilder.append(this.getLocation(), that.getLocation());
        equalsBuilder.append(this.getHunter(), that.getHunter());
    }

    public boolean equals(Object object) {
        if (!(object instanceof Location)) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder();
        equals(object, equalsBuilder);
        return equalsBuilder.isEquals();
    }

    public void toString(ToStringBuilder toStringBuilder) {
        {
            String theId;
            theId = this.getId();
            toStringBuilder.append("id", theId);
        }
        {
            String theName;
            theName = this.getName();
            toStringBuilder.append("name", theName);
        }
        {
            List<Location> theLocation;
            theLocation = this.getLocation();
            toStringBuilder.append("location", theLocation);
        }
        {
            List<MusicHunter> theHunter;
            theHunter = this.getHunter();
            toStringBuilder.append("hunter", theHunter);
        }
    }

    public String toString() {
        final ToStringBuilder toStringBuilder = new JAXBToStringBuilder(this);
        toString(toStringBuilder);
        return toStringBuilder.toString();
    }

    public void hashCode(HashCodeBuilder hashCodeBuilder) {
        hashCodeBuilder.append(this.getId());
        hashCodeBuilder.append(this.getName());
        hashCodeBuilder.append(this.getLocation());
        hashCodeBuilder.append(this.getHunter());
    }

    public int hashCode() {
        final HashCodeBuilder hashCodeBuilder = new JAXBHashCodeBuilder();
        hashCode(hashCodeBuilder);
        return hashCodeBuilder.toHashCode();
    }

    public Location withId(String value) {
        setId(value);
        return this;
    }

    public Location withName(String value) {
        setName(value);
        return this;
    }

    public Location withLocation(Location... values) {
        for (Location value: values) {
            getLocation().add(value);
        }
        return this;
    }

    public Location withHunter(MusicHunter... values) {
        for (MusicHunter value: values) {
            getHunter().add(value);
        }
        return this;
    }

}
